package com.bawei.shopping2.viewmodel

import androidx.lifecycle.ViewModel
import com.bawei.shopping2.entity.BannerEntity
import com.bawei.shopping2.entity.CarGoodsEntity
import com.bawei.shopping2.entity.CategoryEntity
import com.bawei.shopping2.entity.GoodsEntity
import com.bawei.shopping2.http.ApiResponse
import com.bawei.shopping2.repository.CarRepository
import com.bawei.shopping2.repository.DetailRepository
import com.bawei.shopping2.repository.MainRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import okhttp3.RequestBody
import javax.inject.Inject

//注意：依赖注入到viewModel
@HiltViewModel
class CarViewModel @Inject constructor(private var carRepository: CarRepository ):ViewModel() {
    //查看购物车
    suspend fun selectCar():ApiResponse<MutableList<CarGoodsEntity>>{
        return carRepository.selectCar()
    }
    //删除购物车
    suspend fun deleteCar( requestBody: RequestBody):ApiResponse<String>{
        return carRepository.deleteCar(requestBody)
    }
}